package com.jinunn.system.controller;

import com.jinunn.system.common.model.Option;
import com.jinunn.system.common.result.Result;
import com.jinunn.system.service.MenuService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Jindun
 * @version MenuController.java, v0.1 2024年 07⽉ 15⽇  下午2:07 Jindun Exp $
 */
@Tag(name = "菜单接口")
@RestController
@RequestMapping("/api/v1/menus")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class MenuController {

    private final MenuService menuService;

    @Operation(summary = "菜单下拉列表")
    @GetMapping("/options")
    public Result<List<Option<Long>>> listMenuOptions() {
        List<Option<Long>> menus = menuService.listMenuOptions();
        return Result.success(menus);
    }
}
